home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / ODF Release 3 / ODFDev / ODF / OS / FWGraphx / SLGrGlob.cpp < prev    next >
Encoding:
Text File  |  1996-12-16  |  1.9 KB  |  73 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLGrGlob.cpp
  4. //    Release Version:    $ ODF 3 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWOS.hpp"
  11.  
  12. #ifndef SLGRGLOB_H
  13. #include "SLGrGlob.h"
  14. #endif
  15.  
  16. #ifndef FWPRIDEB_H
  17. #include "FWPriDeb.h"
  18. #endif
  19.  
  20. //========================================================================================
  21. //    RunTime Info
  22. //========================================================================================
  23.  
  24. #ifdef FW_BUILD_MAC
  25. #pragma segment fwgraphx
  26. #endif
  27.  
  28. //========================================================================================
  29. //    Graphics globals
  30. //========================================================================================
  31.  
  32. #ifdef FW_BUILD_MAC
  33. CGrafPort        FW_gPrivScratchPortRecord;
  34. GrafPtr            FW_gScratchPort = NULL;
  35. #endif
  36.  
  37. static short    gRefCount = 0;
  38.  
  39. //----------------------------------------------------------------------------------------
  40. // FW_PrivInitializeGraphicsGlobals
  41. //----------------------------------------------------------------------------------------
  42.  
  43. void SL_API FW_PrivInitializeGraphicsGlobals()
  44. {
  45.     if (++ gRefCount == 1)
  46.     {
  47. #ifdef FW_BUILD_MAC
  48.         FW_ASSERT (FW_gScratchPort == NULL);
  49.  
  50.         Rect rBounds = { 0, 0, 10 , 10 };
  51.         
  52.         ::OpenCPort(&FW_gPrivScratchPortRecord);
  53.         FW_gScratchPort = (GrafPtr)&FW_gPrivScratchPortRecord;
  54. #endif
  55.     }
  56. }
  57.  
  58. //----------------------------------------------------------------------------------------
  59. // FW_PrivTerminateGraphicsGlobals
  60. //----------------------------------------------------------------------------------------
  61.  
  62. void SL_API FW_PrivTerminateGraphicsGlobals()
  63. {
  64.     if (-- gRefCount == 0)
  65.     {
  66. #ifdef FW_BUILD_MAC
  67.         FW_ASSERT(FW_gScratchPort != NULL);
  68.         ::CloseCPort(&FW_gPrivScratchPortRecord);
  69.         FW_gScratchPort = NULL;
  70. #endif
  71.     }
  72. }
  73.